﻿<Page
    x:Class="QueryPicturesLibrary.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:QueryPicturesLibrary"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <GridView x:Name="MainList">
            <GridView.Resources>
                <local:ThumbnailConverter x:Key="ShowThumb"/>
            </GridView.Resources>
            <GridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid/>
                </ItemsPanelTemplate>
            </GridView.ItemsPanel>
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Grid Width="200" Height="200" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                        <Image Source="{Binding Path=Thumbnail, Converter={StaticResource ShowThumb}}" 
                               Height="150" 
                               Width="150" 
                               Stretch="UniformToFill"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"/>
                        <Rectangle Width="200" 
                                   Height="20" 
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Fill="Black"
                                   Opacity="0.5"/>
                        <TextBlock Width="180" 
                                   HorizontalAlignment="Center"
                                   TextTrimming="WordEllipsis"
                                   VerticalAlignment="Center" 
                                   Foreground="White" 
                                   Text="{Binding ImageProperties.Title}"/>
                    </Grid>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
    </Grid>
</Page>
